package com.atguigu.algorithm;

import java.util.Scanner;

public class ReverseLetter {
    public static void main(String[] args) {
        Scanner scanner=new Scanner(System.in);
        while(scanner.hasNext()){
            String s=scanner.nextLine();
            StringBuilder res=new StringBuilder();
            StringBuilder tmp=new StringBuilder();
            for(int i=0;i<s.length();i++){
                char ch=s.charAt(i);
                if(Character.isLetter(ch)){
                    tmp.append(ch);
                }else{
                    tmp=tmp.reverse();
                    res.append(tmp+" ");
                    tmp=new StringBuilder();
                }
            }
            res.append(tmp.reverse());
            System.out.println(res.reverse().toString());
        }
    }
}
